﻿CREATE PROCEDURE [UserProfiles_insert]
	@P_1 Int,
	@P_2 NVarChar(100),
	@P_3 NVarChar(50),
	@P_4 NVarChar(50),
	@P_5 DateTime,
	@P_6 Bit,
	@P_7 Int,
	@P_8 Float,
	@P_9 NVarChar(500),
	@P_10 Float,
	@P_11 Float,
	@P_12 Float,
	@P_13 Float,
	@P_14 Float,
	@P_15 Int,
	@P_16 Float,
	@P_17 Int,
	@P_18 Int,
	@P_19 Int,
	@P_20 Float,
	@P_21 DateTime,
	@P_22 DateTime,
	@P_23 Int,
	@sync_row_count Int OUTPUT
AS
BEGIN
SET @sync_row_count = 0; IF NOT EXISTS (SELECT * FROM [UserProfiles_tracking] WHERE [UserProfileID] = @P_1) BEGIN INSERT INTO [UserProfiles]([UserProfileID], [Name], [FirstName], [LastName], [Birthday], [Gender], [Age], [CurrentWeight], [Link], [Timezone], [Height], [TotalCalorieLostGainPerDay], [TotalCalorieLoseGainPerMonth], [BMI], [WeightCategoryID], [BMR], [ActivityLevelID], [HealthRatingID], [TotalCalorieNeedPerDay], [TargetWeight], [DateTimeAdded], [DateTimeUpdated], [LocationID]) VALUES (@P_1, @P_2, @P_3, @P_4, @P_5, @P_6, @P_7, @P_8, @P_9, @P_10, @P_11, @P_12, @P_13, @P_14, @P_15, @P_16, @P_17, @P_18, @P_19, @P_20, @P_21, @P_22, @P_23);  SET @sync_row_count = @@rowcount;  END 
END